<?php

class WebUser extends CWebUser{

    private $_user;
	//is the user an administrator
	function getIsAdmin(){
	    return ( $this->user && $this->user->accessLevel == Users::LEVEL_ADMIN);
	
	}
	//get the logged user
	function getUser(){
	
	   if($this->isGuest){
	      return;
	   }
	   
	   if($this->_user===null){
	   
	      $this->_user = Users::model()->findByPk($this->id);
	   }
	  return $this->_user; 
	}
}
